home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / mxlibs / dwstk102 / err.pas < prev    next >
Pascal/Delphi Source File  |  1995-04-12  |  8KB  |  276 lines

  1. (******************************************************************************
  2. File:          err.pas
  3. Version:     1.02
  4. Tab stops: every 2 columns
  5. Project:     any STK related code
  6. Copyright: 1994-1995 DiamondWare, Ltd.    All rights reserved.
  7. Written:     Keith Weiner & Erik Lorenzen
  8. Purpose:     Contains a routine to handle any error generated by the STK
  9. History:     94/10/21 KW Started
  10.                      95/02/21 EL Finalized for 1.00
  11.                      95/03/18 EL Added new error to err_Display(), dws_BUSY
  12.                      95/03/22 EL Finalized for 1.01
  13.                      95/04/06 EL Added new error to err_Display(), dws_MUSTBECLI
  14.                      95/04/11 EL moved DisplayError to err.c (err_Display).
  15.  
  16. Notes
  17. -----
  18. *Permission is expressely granted to use err_Display or any derivitive made
  19.  from it to registered users of the STK.
  20. ******************************************************************************)
  21.  
  22.  
  23.  
  24. unit err;
  25.  
  26. interface
  27.  
  28. uses crt, dws;
  29.  
  30. procedure err_Display;
  31.  
  32. implementation
  33.  
  34. Procedure err_Display;
  35. begin
  36.     case dws_ErrNo of
  37.  
  38.         dws_EZERO:
  39.         begin
  40.             (*
  41.              . This should not have happened, considering how we got here!
  42.             *)
  43.             writeln('I am confused!  Where am I?  HOW DID I GET HERE????');
  44.             writeln('The ERROR number is:',dws_ErrNo);
  45.         end;
  46.  
  47.         dws_NOTINITTED:
  48.         begin
  49.             (*
  50.              . If we get here, it means you haven't called dws_Init().
  51.              . The STK needs to initialize itself and the hardware before
  52.              . it can do anything.
  53.             *)
  54.             writeln('The STK was not initialized');
  55.         end;
  56.  
  57.         dws_ALREADYINITTED:
  58.         begin
  59.             (*
  60.              . If we get here, it means you've called dws_Init() already.  Calling
  61.              . dws_DetectHardWare() at this point would cause zillions of
  62.              . problems if we let the call through.
  63.             *)
  64.             writeln('The STK was already initialized');
  65.         end;
  66.  
  67.         dws_NOTSUPPORTED:
  68.         begin
  69.             (*
  70.              . If we get here, it means that either the user's machine does not
  71.              . support the function you just called, or the STK was told not to
  72.              . support it in dws_Init.
  73.             *)
  74.             writeln('Function not supported');
  75.         end;
  76.  
  77.         dws_DetectHardware_UNSTABLESYSTEM:
  78.         begin
  79.             (*
  80.              . Please report it to DiamondWare if you get here!
  81.              .
  82.              . Ideally, you would disable control-C here, so that the user can't
  83.              . hit control-alt-delete, causing SmartDrive to flush its (possibly
  84.              . currupt) buffers.
  85.             *)
  86.             writeln('The system is unstable!');
  87.             writeln('Please power down now!');
  88.  
  89.             while (1 = 1) do
  90.             begin
  91.             end;
  92.         end;
  93.  
  94.         (*
  95.          . The following three errors are USER/PROGRAMMER errors.  You forgot
  96.          . to fill the cardtyp struct full of -1's (except in those fields
  97.          . you intended to override, or the user (upon the unlikly event that
  98.          . the STK was unable to find a card) gave you a bad overide value.
  99.         *)
  100.         dws_DetectHardware_BADBASEPORT:
  101.         begin
  102.             (*
  103.              . You set dov.baseport to a bad value, or
  104.              . didn't fill it with a -1.
  105.             *)
  106.             writeln('Bad port address');
  107.         end;
  108.  
  109.         dws_DetectHardware_BADDMA:
  110.         begin
  111.             (*
  112.              . You set dov.digdma to a bad value, or
  113.              . didn't fill it with a -1.
  114.             *)
  115.             writeln('Bad DMA channel');
  116.         end;
  117.  
  118.         dws_DetectHardware_BADIRQ:
  119.         begin
  120.             (*
  121.              . You set dov.digirq to a bad value, or
  122.              . didn't fill it with a -1.
  123.             *)
  124.             writeln('Bad IRQ level');
  125.         end;
  126.  
  127.         dws_Kill_CANTUNHOOKISR:
  128.         begin
  129.             (*
  130.              . The STK points the interrupt vector for the sound card's IRQ
  131.              . to its own code in dws_Init.
  132.              .
  133.              . dws_Kill was unable to restore the vector to its original
  134.              . value because other code has hooked it after the STK
  135.              . initialized(!)  This is really bad.    Make the user get rid
  136.              . of it and call dws_Kill again.
  137.             *)
  138.             writeln('Get rid of your TSR, pal!');
  139.             writeln('(Press any key)');
  140.             repeat
  141.             until (keypressed);
  142.         end;
  143.  
  144.         dws_X_BADINPUT:
  145.         begin
  146.             (*
  147.              . The mixer funtion's can only accept volumes between 0 & 255,
  148.              . the volume will remain unchanged.
  149.             *)
  150.             writeln('Bad mixer level');
  151.         end;
  152.  
  153.         dws_D_NOTADWD:
  154.         begin
  155.             (* You passed the STK a pointer to something which is not a .DWD file! *)
  156.             writeln('The file you are attempting to play is not a .DWD');
  157.         end;
  158.  
  159.         dws_D_NOTSUPPORTEDVER:
  160.         begin
  161.             (*
  162.              . The STK can't play a .DWD converted using a version of VOC2DWD.EXE
  163.              . newer than itself.  And, although we'll try to maintain backwards
  164.              . compatibility, we may not be able to guarantee that newer versions
  165.              . of the code will be able to play older .DWD files.  In any event,
  166.              . it's a good idea to always convert .VOC files with the utility
  167.              . which comes with the library you're linking into your application.
  168.             *)
  169.             writeln('Please reconvert this file using the VOC2DWD.EXE which came with this library');
  170.         end;
  171.  
  172.         dws_D_INTERNALERROR:
  173.         begin
  174.             (*
  175.              . This error should never occur and probably will not affect sound
  176.              . play(?).  If it happens please contact DiamondWare.
  177.             *)
  178.             writeln('An internal error has occured');
  179.             writeln('Please contact DiamondWare');
  180.         end;
  181.  
  182.         dws_DPlay_NOSPACEFORSOUND:
  183.         begin
  184.             (*
  185.              . This error is more like a warning, though it may happen on a
  186.              . regular basis, depending on how many sounds you told the STK
  187.              . to allow in dws_Init, how you chose to prioritize sounds and
  188.              . how many sounds are currently being played.
  189.             *)
  190.             writeln('No more room for new digitized sounds right now');
  191.         end;
  192.  
  193.         dws_DSetRate_FREQTOLOW:
  194.         begin
  195.             (*
  196.              . The STK will set rate as close as possible to the indicated rate
  197.              . but cannot set a rate that low.
  198.             *)
  199.             writeln('Playback frequency too low');
  200.         end;
  201.  
  202.         dws_DSetRate_FREQTOHIGH:
  203.         begin
  204.             (*
  205.              . The STK will set rate as close as possible to the indicated rate
  206.              . but cannot set a rate that high.
  207.             *)
  208.             writeln('Playback frequency too high');
  209.         end;
  210.  
  211.         dws_MPlay_NOTADWM:
  212.         begin
  213.             (* You passed the STK a pointer to something which is not a .DWM file! *)
  214.             writeln('The file you are attempting to play is not a .DWM');
  215.         end;
  216.  
  217.         dws_MPlay_NOTSUPPORTEDVER:
  218.         begin
  219.             (*
  220.              . The STK can't play a .DWM converted using a version of VOC2DWM.EXE
  221.              . newer than itself.  And, although we'll try to maintain backwards
  222.              . compatibility, we may not be able to guarantee that newer versions
  223.              . of the code will be able to play older .DWM files.  In any event,
  224.              . it's a good idea to always convert .MID files with the utility
  225.              . which comes with the library you're linking into your application.
  226.             *)
  227.             writeln('Please reconvert this file using the MID2DWM.EXE which came with this library');
  228.         end;
  229.  
  230.         dws_MPlay_INTERNALERROR:
  231.         begin
  232.             (*
  233.              . This error should never occur and probably will not affect sound
  234.              . play(?). If it happens please contact DiamondWare.
  235.             *)
  236.             writeln('An internal error has occured.');
  237.             writeln('Please contact DiamondWare');
  238.         end;
  239.  
  240.         dws_BUSY:
  241.         begin
  242.             (*
  243.              . Can only occur when DWS is being called from the background
  244.              . (within an ISR--possibly timer or keyboard handler.)  If you get
  245.              . this error, do your IRET, and call again from your next interrupt.
  246.              . Repeat until successful.
  247.             *)
  248.             writeln('DWS is busy now, please call again later.');
  249.         end;
  250.  
  251.          (*
  252.  
  253.         dws_IRQDISABLED:
  254.         begin
  255.             . The following error may be triggered by dws_Init, dws_Kill,
  256.             . or dws_DetectHardWare.    It occurs if interrupts are disabled.
  257.             . Enable interrupts (execute the STI instruction) and call again.
  258.             writeln('Enable interrupts and call again.');
  259.         end;
  260.          *)
  261.  
  262.         else
  263.         begin
  264.             (*
  265.              . If this function was clipped intact from err.c, this case
  266.              . should never occur and probably will not affect sound play(?)
  267.              . If it happens please contact DiamondWare.
  268.             *)
  269.             writeln('I am confused!  Where am I?  HOW DID I GET HERE????');
  270.             writeln('The ERROR number is:',dws_ErrNo);
  271.         end;
  272.     end;
  273. end;
  274.  
  275. end.
  276.